<template>
  <div>
    <el-row :gutter="20">
      <el-col :span="8">
        <el-card shadow="hover" class="mgb20" style="height: 252px">
          <div class="user-info">
            <img :src="imgUrl" class="user-avator" alt />
            <div class="user-info-cont">
              <div class="user-info-name">{{ user.username }}</div>
              <div>超级管理员</div>
            </div>
          </div>
          <div class="user-info-list">
            上次登录时间：
            <span>2023-9-18</span>
          </div>
          <div class="user-info-list">
            上次登录地点：
            <span>重庆</span>
          </div>
        </el-card>
        <el-card shadow="hover" style="height: 252px">
          <template #header>
            <div class="clearfix">
              <span>景点热度</span>
            </div>
          </template>
          奇幻游乐园<el-progress :percentage="71.3" color="#42b983"></el-progress>
          鸠鹚古镇<el-progress :percentage="24.1" color="#f1e05a"></el-progress>
          滕王阁<el-progress :percentage="13.7"></el-progress>
          仙湖植物公园<el-progress :percentage="5.9" color="#f56c6c"></el-progress>
        </el-card>
      </el-col>
      <el-col :span="16">
        <el-row :gutter="20" class="mgb20">
          <el-col :span="8">
            <el-card shadow="hover" :body-style="{ padding: '0px' }">
              <div class="grid-content grid-con-1">
                <i class="el-icon-user-solid grid-con-icon"></i>
                <div class="grid-cont-right">
                  <div class="grid-num">1234</div>
                  <div>用户访问量</div>
                </div>
              </div>
            </el-card>
          </el-col>
          <el-col :span="8">
            <el-card shadow="hover" :body-style="{ padding: '0px' }">
              <div class="grid-content grid-con-2">
                <i class="el-icon-message-solid grid-con-icon"></i>
                <div class="grid-cont-right">
                  <div class="grid-num">321</div>
                  <div>系统消息</div>
                </div>
              </div>
            </el-card>
          </el-col>
          <el-col :span="8">
            <el-card shadow="hover" :body-style="{ padding: '0px' }">
              <div class="grid-content grid-con-3">
                <i class="el-icon-s-goods grid-con-icon"></i>
                <div class="grid-cont-right">
                  <div class="grid-num">5000</div>
                  <div>数量</div>
                </div>
              </div>
            </el-card>
          </el-col>
        </el-row>
        <el-card shadow="hover" style="height: 403px">
          <template #header>
            <div class="clearfix">
              <span>最新评论</span>
              <el-button style="float: right; padding: 3px 0" type="text">更多</el-button>
            </div>
          </template>

          <el-table :show-header="false" :data="todoList" style="width: 100%">
            <el-table-column width="40">
              <template #default="scope">
                <el-checkbox v-model="scope.row.status"></el-checkbox>
              </template>
            </el-table-column>
            <el-table-column>
              <template #default="scope">
                <div class="todo-item" :class="{
                  'todo-item-del': scope.row.status,
                }">
                  {{ scope.row.title }}
                </div>
              </template>
            </el-table-column>
            <el-table-column width="60">
              <template>
                <i class="el-icon-edit"></i>
                <i class="el-icon-delete"></i>
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
// @ is an alias to /src
import { reactive, ref } from "vue";
import { IMG_URL } from "@/utils/imgStatic";
import request from "../../utils/request";
const {user} = JSON.parse(localStorage.getItem("userInfo"))
const imgUrl = `${IMG_URL}${user.uImg}`;
const todoList = reactive([
  {
    title: "奇幻游乐园的精华在于其丰富多彩的游玩项目,涵盖了从刺激的过山车、云霄飞车,到休闲的旋转木马、摩天轮等,满足不同年龄段游客的需求。",
    status: false,
  },
  {
    title: "这样的鸠兹古镇谁不爱！非遗、人文、美食、演艺秀、梦幻夜景等，你要的这里都有！",
    status: false,
  },
  {
    title: "江南三大名楼之一，具有浓郁的地方特色，看见历朝历代文人雅士们歌咏滕王阁的诗数不胜数，让自己对中国文化有了更深刻的了解。很值得参观!",
    status: false,
  },
  {
    title: "仙湖植物园是一个知名地，而且里面供奉着五彩斑斓的舍利子，很适合祈福。另外植物园环境也很美，适合周末来玩。",
    status: false,
  },
  {
    title: "滑雪场以其独特的雪景和丰富多样的雪道而闻名。这里的雪质优良，适合滑雪爱好者的各个级别，还有滑雪教练提供专业指导。",
    status: true,
  },
  {
    title: "颐和园的风景让人陶醉，下次还来",
    status: true,
  },
]);
</script>
<style lang="scss" scoped>
.el-row {
  margin-bottom: 20px;
}

.grid-content {
  display: flex;
  align-items: center;
  height: 100px;
}

.grid-cont-right {
  flex: 1;
  text-align: center;
  font-size: 14px;
  color: #999;
}

.grid-num {
  font-size: 30px;
  font-weight: bold;
}

.grid-con-icon {
  font-size: 50px;
  width: 100px;
  height: 100px;
  text-align: center;
  line-height: 100px;
  color: #fff;
}

.grid-con-1 .grid-con-icon {
  background: rgb(45, 140, 240);
}

.grid-con-1 .grid-num {
  color: rgb(45, 140, 240);
}

.grid-con-2 .grid-con-icon {
  background: rgb(100, 213, 114);
}

.grid-con-2 .grid-num {
  color: rgb(45, 140, 240);
}

.grid-con-3 .grid-con-icon {
  background: rgb(242, 94, 67);
}

.grid-con-3 .grid-num {
  color: rgb(242, 94, 67);
}

.user-info {
  display: flex;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 2px solid #ccc;
  margin-bottom: 20px;
}

.user-avator {
  width: 120px;
  height: 120px;
  border-radius: 50%;
}

.user-info-cont {
  padding-left: 50px;
  flex: 1;
  font-size: 14px;
  color: #999;
}

.user-info-cont div:first-child {
  font-size: 30px;
  color: #222;
}

.user-info-list {
  font-size: 14px;
  color: #999;
  line-height: 25px;
}

.user-info-list span {
  margin-left: 70px;
}

.mgb20 {
  margin-bottom: 20px;
}

.todo-item {
  font-size: 14px;
}

.todo-item-del {
  text-decoration: line-through;
  color: #999;
}
</style>
